package com.usian.controller;

import com.github.pagehelper.PageInfo;
import com.usian.pojo.Job;
import com.usian.service.JobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/job")
public class JobController {

    @Autowired
    private JobService jobService;


    @RequestMapping("/findAll")
    public PageInfo<Job> findAll(Integer page, Integer size, @RequestBody Job job){
        if (null == page){
            page = 1;
        }
        if (null == size){
            size = 2;
        }
        return jobService.findAll(page,size,job);
    }

    @RequestMapping("/add")
    public void add(@RequestBody Job job){
        jobService.add(job);
    }

    @RequestMapping("/etid")
    public void etid(@RequestBody Job job){
        jobService.etid(job);
    }

    @RequestMapping("/del")
    public void del(Integer id){
        jobService.del(id);
    }

}
